Efficient fpga multipliers

ABSTRACT

In some example embodiments a logical block comprising twelve inputs and two six-input lookup tables (LUTs) is provided, wherein four of the twelve inputs are provided as inputs to both of the six-input lookup tables. This configuration supports efficient field programmable gate array (FPGA) implementation of multipliers. Each six-input LUT comprises two five-input lookup tables (LUT5s) that are used to form Booth encoding multiplier building blocks. The five inputs to each LUT5 are two bits from a multiplier and three Booth-encoded bits from a multiplicand. By assembling building blocks, multipliers of arbitrary size may be formed.

PRIORITY CLAIM

This application is a continuation of U.S. patent application Ser. No.16/134,579, filed Sep. 18, 2018 and titled “Efficient FPGA Multipliers,”which claims the benefit of priority to U.S. Provisional PatentApplication Ser. No. 62/697,847, filed Jul. 13, 2018, and titled“Efficient FPGA Multipliers,” each of which is incorporated herein byreference in its entirety.

BACKGROUND

Field-programmable gate arrays (FPGAs) are integrated circuitscustomized after manufacture. An FPGA comprises an array of logic blockscomprising elements such as lookup tables (LUTs), adders, andflip-flops.

A multiplier circuit generates a product of two factors: themultiplicand and the multiplier.

BRIEF DESCRIPTION OF THE DRAWINGS

Some embodiments of the disclosed technology are illustrated by way ofexample and not limitation in the figures of the accompanying drawings.

FIG. 1 is a diagrammatic view of an example circuit chip fabric,according to various embodiments of the invention.

FIG. 2 is a block diagram illustrating components of a system thatprograms an FPGA, according to some example embodiments.

FIG. 3 is a diagrammatic view of a least significant bit (LSB) Boothmultiplier building block, according to various embodiments of theinvention.

FIG. 4 is a diagrammatic view of a Booth multiplier building block,according to various embodiments of the invention.

FIG. 5 is a diagrammatic view of a most significant bit (MSB) Boothmultiplier building block, according to various embodiments of theinvention.

FIG. 6 is a diagrammatic view of a 4-bit Booth multiplier buildingblock, according to various embodiments of the invention.

FIG. 7 is a diagrammatic view of an 8-bit Booth multiplier buildingblock, according to various embodiments of the invention.

FIG. 8 is a diagrammatic view of an 8-bit multiplier using 8-bit Boothmultiplier building blocks, according to various embodiments of theinvention.

FIG. 9 is a diagrammatic view of an 8-bit multiplier using MSB Boothmultiplier building blocks and 4-bit Booth multiplier building blocks,according to various embodiments of the invention.

FIG. 10 is a diagrammatic view of a modified 6-bit LUT, according tovarious embodiments of the invention.

FIG. 11 is a diagrammatic view of a modified block comprising two 6-bitLUTs, according to various embodiments of the invention.

FIG. 12 is a diagrammatic view of a logic block using the modified blockto provide a 4-bit by 2-bit multiplier, according to various embodimentsof the invention.

DETAILED DESCRIPTION

Example methods, systems and circuits for efficient FPGA multiplierswill now be described. In the following description, numerous exampleshaving example-specific details are set forth to provide anunderstanding of example embodiments. It will be evident, however, toone of ordinary skill in the art that these examples may be practicedwithout these example-specific details, and/or with differentcombinations of the details than are given here. Thus, specificembodiments are given for the purpose of simplified explanation, and notlimitation.

In radix-4 modified Booth encoding, a multiplicand is recoded two bitsat a time using overlapping groups of three bits. A zero is post-pendedto the right of bit zero. Thus, the first group of three bits is {x₁,x₀, 0}; the second group of three bits is {x₃, x₂, x₁}, and so on. Eachgroup of three bits is recoded as a partial product of the multiplierand the partial products are summed to yield the product of themultiplier and the multiplicand. The multiplier and multiplicand arerepresented in two's-complement notation.

Table 1, below, refers to the multiplicand as B and the multiplier as A.The table shows the partial product for any of the above-referencedthree-bit sequences of B. The size of B is N. The index j is an oddnumber from one to the size of B minus one, such that B[N−1] refers tothe MSB of B, B[0] refers to the LSB of B, and B[−1] is an appended 0bit.

TABLE 1 B[J] B[J−1] B[J−2] Partial Product Comments 0 0 0 0 String of 0s0 0 1 +A End of 1s 0 1 0 +A Single 1 0 1 1 +2A End of 1s 1 0 0 −2ABeginning of 1s 1 0 1 −A Single 0 1 1 0 −A Beginning of 1s 1 1 1 −0String of 1s

Table 2, below, shows the bit-wise representation of each partialproduct. M is the size of A, such that A[M−1] refers to the MSB of A.The “Op” column indicates the value to be added to the partial productbefore combining the partial product with the other partial products tofind the product. Inverted bits (used in the −A and −2A partialproducts) are indicated with a prime mark (e.g., A[M−1]′).

TABLE 2 Partial Product P [M] P [M − 1] P [M − 2] . . . P [2] P [1] P[0] Op +0 0 0 0 . . . 0 0 0 0 +A A [M − 1] A [M − 1] A [M − 2] . . . A[2] A [1] A [0] 0 +2A A [M − 1] A [M − 2] A [M − 3] . . . A [1] A [0] 00 −0 1 1 1 . . . 1 1 1 1 −A A [M − 1]′ A [M − 1]′ A [M − 2]′ . . . A[2]′ A [1]′ A [0] 1 −2A A [M − 1]′ A [M − 2]′ A [M − 3]′ . . . A [1] A[0] 1 1

The partial products are summed and given appropriate weights for thebit positions of the portions of B used to generate each partialproduct. Thus, since the bits of B used to generate each partial productshift by two, the results of each successive partial product will beshifted two bits to the left before summing. As a result, the firstpartial product will have M bits, the second will have M+2 bits, and soon. To perform the sum, the shorter partial products will be signextended to be the same length as the longest partial product. Intwo's-complement notation, the MSB is 1 if the number is negative and 0if the number is positive. Sign-extending a number duplicates the MSBfor all added bits to the left of the MSB, thus avoiding changing eitherthe value or the sign of the number.

The Booth encoding can be performed using LUTs. In some exampleembodiments, five-input LUTs (LUT5s) are used. The five inputs to eachLUT5 are two bits from a multiplier and three Booth-encoded bits from amultiplicand. By assembling building blocks, each comprising a LUT5,multipliers of arbitrary size may be formed. By way of example, aneight-bit multiplier is described herein.

As discussed above, a partial product is generated for each two bits ofB. Thus, for a B of size N, the number of partial products is

$\frac{N}{2}.$

Each partial product uses M+1 LUT5s to generate the M+1 bits of eachpartial product shown in Table 2. If modified six-input LUTs (LUT6s) areused in place of LUT5s, one LUT6 can replace two LUT5s. Thus,

$\frac{M}{2} + 1$

LUT6s are used per row. As a result,

$\frac{\left( {M + 1} \right) \times N}{4}$

LUT6s are used to implement a multiplier for arbitrary values of M andN. The splitting of the LUT6 into two LUT5 sub-functions, along withefficient sharing of the inputs between pairs of LUT6 blocks, results ina significant improvement over prior art implementations.

In some example embodiments, this functionality is enabled through theuse of a novel LUT6 design for use in an FPGA. A traditional LUT6 may beimplemented using two LUT5s that take identical inputs. Disclosed hereinis a novel LUT6 design in which an additional input is provided to theLUT6. In a first mode, the LUT6 operates as a traditional LUT6, with thesame five inputs being provided to both LUT5s. In a second mode, theother additional input is used as an input to one of the LU5s while theother LUT5 takes the standard inputs. Thus, in the second mode, onlyfour of the five inputs to the two LUT5s are identical and the fifth maybe different. The modified LUT6 provides two additional outputs: one foreach LUT5. Accordingly, in the first mode, the standard output is usedand in the second mode, the two LUT5 outputs are used. The mode isselected at the time of place and route of the FPGA.

Using the novel LUT6 design in a circuit chip fabric that allows thetwelve inputs to two LUT6 blocks to be shared allows a 2×4 Boothmultiplier building block to be built that efficiently makes use of theLUT6s without requiring additional logic blocks. This efficient packingof Booth multiplier building blocks provides a density advantage,allowing more multipliers to be built on a single chip. Additionally,since the novel LUT6 design can be configured as a traditional LUT6,existing place and route methodologies can be used to program FPGAsusing the novel LUT6 in the traditional mode.

Support for arbitrary numbers of arbitrarily sized multipliers may beparticularly useful in implementation of neural networks, which performlarge numbers of multiplications in each layer. Since FPGAs are lessexpensive than processors and using the methods described herein, asingle FPGA can simultaneously perform many multiplication operations,use of the designs described herein may improve the rate at which neuralnetworks can be trained, reduce the power costs associated with neuralnetworks, or both.

By way of example and not limitation, this disclosure details theimplementation of multiplication for two's complement (signed) numbers.Using the proposed sharing of the two LUT6 inputs, the same structurewill support the multiplication of unsigned numbers. In some exampleembodiments, this is accomplished by placing a leading zero in front ofthe multiplier and multiplicand to force the two's complement circuitryto recognize the inputs as positive. Alternatively, for a more compactimplementation, the LUT6 programming can be modified with the proposedinput sharing to perform the unsigned multiplication more efficiently.Additionally, the interconnect amongst the 4×2 multiplier blocks ismodified since the Baugh-Wooley sign extension method is not needed forunsigned numbers and sign extension is not necessary. This difference ininterconnect is accomplished using the general-purpose routing in theFPGA.

Additionally, the support for unsigned multiplication can be convertedto sign-magnitude format by unsigned multiplication on the twosign-magnitude numbers and using an additional LUT6 to track the sign ofthe product by performing a logical XOR of the multiplier andmultiplicand sign bits.

FIG. 1 is a diagrammatic view of an example circuit chip fabric 100,according to various embodiments of the invention. The fabric 100contains programmable arrays of logic blocks 101 that support a varietyof programmable logic functions. Routing tracks 102 in the fabric 100,illustrated as a plurality of orthogonally oriented tracks, are used tocarry electronic signals and implement reconfigurable interconnectionsbetween the logic blocks 101. The major elements of a flexible routingarchitecture used to interconnect the routing tracks and configure thelogic blocks include connection boxes 110 and switch boxes 111.

In implementation, the switch boxes 111 can be switches that connectwires to wires the wires in the horizontal and vertical routing tracks:wires in horizontal tracks to wires in horizontal tracks, wires invertical tracks to wires in vertical tracks, and wires in horizontaltracks to wires in vertical tracks). The connection boxes 110 can beswitches that connect wires in horizontal and/or vertical tracks to thelogic block 101 elements. For purposes of illustration, only exemplaryelements in the drawing figure have been marked. However, a person ofordinary skill in the art will understand that the routing tracks 102,the connection boxes 110, and the switch boxes 111 can, in practice, bereplicated over the surface of a semiconductor chip in order to providethe desired interconnection functionality.

The structure of the connection boxes 110 and the switch boxes 111determine the connections of the routing tracks 102 to the logic blocks101, thereby determining the functionality of a semiconductor chip 120that includes them. For example, a semiconductor chip 120 that includesthe fabric 100 may be fabricated as an FPGA, such as the type availablefrom Achronix™, Xilinx™, Altera™ and other vendors.

In some example embodiments, each logic block includes LUTs, anarithmetic chain, and optional registers. Through the use of the novelLUT configurations described herein, the number of LUTs used toimplement multiplication may be reduced. As a result, less area is usedby logic blocks implementing a multiplication function. As a furtherresult, since less area is used, the propagation time between theinvolved logic blocks is reduced, which reduces the time taken tocomplete a multiplication. Additionally, the use of fewer logic blocksper multiplier consumes less power, allows more multipliers to be placedon a single FPGA chip, or both.

FIG. 2 is a block diagram illustrating components of a computer 200 thatprograms an FPGA, according to some example embodiments. All componentsneed not be used in various embodiments. For example, clients, servers,autonomous systems, and cloud-based network resources may each use adifferent set of components, or, in the case of servers for example,larger storage devices.

One example computing device in the form of a computer 200 (alsoreferred to as computing device 200 and computer system 200 ) mayinclude a processor 205, memory storage 210, removable storage 215, andnon-removable storage 220, all connected by a bus 240. Although theexample computing device is illustrated and described as the computer200, the computing device may be in different forms in differentembodiments. For example, the computing device may instead be asmartphone, a tablet, a smartwatch, or another computing deviceincluding elements the same as or similar to those illustrated anddescribed with regard to FIG. 2. Devices such as smartphones, tablets,and smartwatches are collectively referred to as “mobile devices.”Further, although the various data storage elements are illustrated aspart of the computer 200, the storage may also or alternatively includecloud-based storage accessible via a network, such as the Internet, orserver-based storage.

The memory storage 210 may include volatile memory 245 and non-volatilememory 250, and may store a program 255. The computer 200 may include,or have access to, a computing environment that includes, a variety ofcomputer-readable media, such as the volatile memory 245; thenon-volatile memory 250; the removable storage 215; and thenon-removable storage 220. Computer storage includes random-accessmemory (RAM), read-only memory (ROM), erasable programmable read-onlymemory (EPROM) and electrically erasable programmable read-only memory(EEPROM), flash memory or other memory technologies, compact discread-only memory (CD ROM), digital versatile disks (DVD) or otheroptical disk storage, magnetic cassettes, magnetic tape, magnetic diskstorage or other magnetic storage devices, or any other medium capableof storing computer-readable instructions.

The computer 200 may include or have access to a computing environmentthat includes an input interface 225, an output interface 230, and acommunication interface 235. The output interface 230 may interface toor include a display device, such as a touchscreen, that also may serveas an input device. The input interface 225 may interface to or includeone or more of a touchscreen, a touchpad, a mouse, a keyboard, a camera,one or more device-specific buttons, one or more sensors integratedwithin or coupled via wired or wireless data connections to the computer200, and other input devices. The computer 200 may operate in anetworked environment using the communication interface 235 to connectto one or more remote computers, such as database servers. The remotecomputer may include a personal computer (PC), server, router, networkFSC, peer device or other common network node, or the like. Thecommunication interface 235 may connect to a local-area network (LAN), awide-area network (WAN), a cellular network, a WiFi network, a Bluetoothnetwork, or other networks.

Computer instructions stored on a computer-readable medium (e.g., theprogram 255 stored in the memory storage 210 ) are executable by theprocessor 205 of the computer 200. A hard drive, CD-ROM, and RAM aresome examples of articles including a non-transitory computer-readablemedium such as a storage device. The terms “computer-readable medium”and “storage device” do not include carrier waves to the extent thatcarrier waves are deemed too transitory. “Computer-readablenon-transitory media” includes all types of computer-readable media,including magnetic storage media, optical storage media, flash media,and solid-state storage media. It should be understood that software canbe installed in and sold with a computer. Alternatively, the softwarecan be obtained and loaded into the computer, including obtaining thesoftware through a physical medium or distribution system, including,for example, from a server owned by the software creator or from aserver not owned but used by the software creator. The software can bestored on a server for distribution over the Internet, for example.

The program 255 is shown as including a configuration module 260 and aplace and route module 265. Any one or more of the modules describedherein may be implemented using hardware a processor of a machine, anapplication-specific integrated circuit (ASIC), an FPGA, or any suitablecombination thereof). Moreover, any two or more of these modules may becombined into a single module, and the functions described herein for asingle module may be subdivided among multiple modules. Furthermore,according to various example embodiments, modules described herein asbeing implemented within a single machine, database, or device may bedistributed across multiple machines, databases, or devices.

The configuration module 260 provides a user interface to allow a userto provide a configuration for an FPGA. For example, the user interfacemay allow the user to identify a hardware design language (HDL) filethat specifies the configuration.

The place and route module 265 programs the FPGA based on theconfiguration. For example, the connection boxes 110, the switch boxes111, and the routing tracks 102 may be configured. As another example,the connections to and from LUTs, as well as their contents (i.e., theparticular output generated for each combination of inputs), may beconfigured.

FIG. 3 is a diagrammatic view of an LSB Booth multiplier building block300, according to various embodiments of the invention. The LSB Boothmultiplier building block 300 comprises a LUT5 310, exclusive OR (XOR)gates 320 and 330, AND gates 340, 350, and 360, and OR gates 370 and380. The two factors are referred to as A and B, with individual bitswithin each factor indicated by a number in brackets. Bit 0 is the LSB.Multiple bits within a factor are indicated as a range. For example,B[1:0] represents the two least significant bits of multiplicand B.Similarly, the LSB Booth multiplier building block 300 may receive a suminput, IN[0], from a previous row of a larger multiplier structure. Ifthere is no previous row, IN[0] may be set to 0. The LSB Boothmultiplier building block 300 may receive a carry input, CIN, from abuilding block to the right. If there is no building block to the right,as is typically the case for an LSB building block, CIN may be set to 0.The LSB Booth multiplier building block 300 generates two outputs: theLSB of a sum output, OUT101, and a carry output, COUT.

The LUT5 310 takes the LSB of A and the two least significant bits of Bas inputs, along with two 0s. The five input bits generate a 1-bitoutput. The gates 320-380 together form an adder that adds IN[0], theoutput of the LUT5 310, and CIN. The adder formed by the gates 320-380is a ripple adder, but other types of adders are used in other exampleembodiments. For example, a ripple carry adder, a carry-look-aheadadder, or a carry-save-adder could be used instead. COUT contains thehigh bit of the adder result and OUT[0] contains the low bit of theadder result. Thus, in the special case that IN[0] and CIN are bothzero, COUT will be zero and OUT[0] will be the result from the LUT5.Below is a table that shows the 1-bit output of the LUT5 for anycombination of A and B inputs.

A[I] A|I-1] B[J] B[J-1] B[J-2| RESULT ANY ANY 0 0 0 0 0 ANY 0 0 1 0 1ANY 0 0 1 1 0 ANY 0 1 0 0 1 ANY 0 1 0 1 ANY 0 0 1 1 0 ANY 1 0 1 1 1 ANY0 1 0 0 1 ANY 1 1 0 0 0 0 ANY 1 0 1 1 1 ANY 1 0 1 0 0 ANY 1 1 0 1 1 ANY1 1 0 0 ANY ANY 1 1 1 1

FIG. 4 is a diagrammatic view of a Booth multiplier building block 400,according to various embodiments of the invention. The Booth multiplierbuilding block 400 comprises a LUT5 410, XOR gates 420 and 430, ANDgates 440, 450, and 460, and OR gates 470 and 480. The Booth multiplierbuilding block 400 is the same as the LSB Booth multiplier buildingblock 300, generalized to handle other portions of the factors. Theinputs to the LUT5 410 are A[I:I−1] and. B[J:J−2], wherein I is anyvalue from 0 to the MSB of A and J is any odd value from 1 to the MSB ofB. If the size of B is odd (i.e., the index to the MSB of B is even), Bmay be sign-extended by one bit prior to performing the multiplication.Both A[−1] and B[−1] are treated as a zero.

FIG. 5 is a diagrammatic view of an MSB Booth multiplier building block500, according to various embodiments of the invention. The Boothmultiplier building block 500 comprises a LUT5 505, a LUT5 510, XORgates 520, 530, and 590, AND gates 540, 550, and 560, and OR gates 570and 580. The MSB Booth multiplier building block 500 is the same as theBooth multiplier building block 400, with the modification of theaddition of the LUT5 505 and the XOR gate 590. The inputs to the LUT5510 are A[MSB], prepended with a 0, and B[J:J−2].

The LUT5 505 is configured to provide a 1 as output regardless of theinput. Accordingly, the input to the LUT5 505 may be connected to anyconvenient source; for example, the LUT5 505 may use the same inputs asthe LUT5 510. The XOR gate 590 takes one input from the LUT5 505 and oneinput from the OR gate 580. Since the input from the LUT5 505 is always1, the COUT output from the XOR gate 590 is the inverse of the output ofthe OR gate 580. Using the LUT5 505 to generate a 1 output allows themodified LUT6 1000 of FIG. 10, described below, to be used to implementboth LUT5 505 and LUT5 510.

FIG. 6 is a diagrammatic view of a 4-bit Booth multiplier building block600, according to various embodiments of the invention. The 4-bit Boothmultiplier building block 600 includes four 1-bit building blocks 610,620, 630, and 640, which may be instantiations of the Booth multiplierbuilding block 400. The 4-bit Booth multiplier building block 600receives a 4-bit sum input (IN) from a previous row, a 5-bit A input, a3-bit Booth encoded B input, and a 1-bit CIN connected to the COUT of aBooth multiplier building block to the right. IN is set to zero if thereis no previous row. CIN is set to zero if there is no Booth multiplierbuilding block to the right. The portion of A handled by the 4-bit Boothmultiplier building block 600 is indicated by the index I, which is oneless than a multiple of 4 (e.g., 3, 7, 11, 15, and so on). For thespecial case that I is 3, the input bits for A are A[3:−1], and theinput should provide a zero for A['1]. The portion of B handled by the4-bit Booth multiplier building block 600 is indicated by the index J,which is an odd number. For the special case that J is 1, the input bitsfor B are B[1:−1], and the input should provide a zero for B[−1].

Each 1-bit building block 610-640 takes two A bits and three B bits asinputs to a LUT5, one bit of IN as the sum input from the previous row,and a 1-bit carry input. Each 1-bit building block 610-640 generates oneoutput bit for the result and one carry output bit. The carry output bitof each block is connected to the carry input of the next block to theleft; the carry output bit of the left-most block is the carry outputvalue for the 4-bit Booth multiplier building block 600.

Taken as a block standing alone (i.e., with IN and CIN set to zero), the4-bit Booth multiplier building block 600 takes four bits of A and threeBooth-encoded bits of B as inputs and generates a five-bit partialproduct, considering COUT as the MSB. In combination with other Boothmultiplier building blocks, as seen in FIG. 9, the 4-bit Boothmultiplier building block 600 may be used to create multipliers ofarbitrary size in an FPGA.

FIG. 7 is a diagrammatic view of an 8-bit Booth multiplier buildingblock 700, according to various embodiments of the invention. The 8-bitBooth multiplier building block 700 includes 1-bit Booth multiplierbuilding blocks 710, 720, 730, 740, 750, 760, 770, and 780 as well asMSB Booth multiplier building block 790. The inputs to the 8-bit Boothmultiplier building block 700 include an 8-bit A input (A[7:0]), a threebit Booth-encoded B input (B[J:J-2]), an 8-bit sum (IN) from a previousrow, and a 1-bit carry input (CIN) from a building block to the right.IN and CIN are set to zero if the 8-bit Booth multiplier building block700 is the first row or the right-most building block, respectively. TheA and IN inputs are divided and provided to the 1-bit Booth multiplierbuilding blocks 710-780 as shown in FIG. 7 and described below. The8-bit Booth-encoded multiplier building block 700 generates an eight-bitoutput (OUT) and a 1-bit carry output (COUT).

Each 1-bit Booth multiplier building block 710-780 takes two of the Abits and the three Booth-encoded B bits as inputs to a LUT5, one of theIN bits from the previous row (set to 0 if there is no previous row),and a 1-bit carry input (set to CIN for the right-most 1-bit Boothmultiplier building block 710 ). Each 1-bit Booth multiplier buildingblock 710-780 generates one output bit for the result and one carryoutput bit. The carry output bit of each 1-bit block 710-780 isconnected to the carry input of the next block to the left. In someexample embodiments, each 1-bit Booth multiplier building block 710-780has the same structure the structure of the 1-bit Booth multiplierbuilding block 400).

The MSB Booth multiplier building block 790 takes the MSB of A,prepended with a zero as the A input, and takes the same threeBooth-encoded bits as the other building blocks as the B input. For the1-bit sum input from the previous row, the IN bit used as the input forthe 1-bit Booth multiplier building block 780 is duplicated. The carryinput for the MSB Booth multiplier building block 790 is the carryoutput of the 1-bit Booth multiplier building block 780; the carryoutput bit of the MSB Booth multiplier block is the carry output (COUT)value for the 8-bit Booth multiplier building block 700.

Taken as a stand alone block (i.e., with IN and CIN set to zero), the8-bit Booth multiplier building block 700 takes eight bits of A andthree Booth-encoded bits of B as inputs and generates a nine-bit partialproduct, considering GOUT as the MSB. In combination with other Boothmultiplier building blocks, as seen in FIG. 8, the 8-bit Boothmultiplier building block 700 may be used to create an 8-bit multiplier.

FIG. 8 is a diagrammatic view of an 8-bit multiplier 800 using 8-bitBooth multiplier building blocks, according to various embodiments ofthe invention. The 8-bit multiplier 800 includes 8-bit Booth multiplierbuilding blocks 810, 820, 830, and 840. Each of the 8-bit Boothmultiplier building blocks 810 -840 may be an instance of the 8-bitBooth multiplier building block 700.

Each 8-bit Booth multiplier building block 810 -840 takes all eight bitsof A (A[7:0]) as an input and provides them as pairwise inputs to thenine component blocks 710-790 shown in FIG. 7. The first 8-bit Boothmultiplier building block 810 takes the first two bits of B and apadding zero as the B input, indicated as B[1:−1]. The second 8-bitBooth multiplier building block 820 takes the next two bits of B and anoverlapping bit, indicated as B[3:1]. This pattern is repeated, with the8-bit Booth multiplier building block. 830 taking B[5:3] as the B inputand the 8-bit Booth multiplier building block 840 taking B[7:5] as the Binput. Stated another way, and with reference to FIG. 7, J is 1 for the8-bit Booth multiplier building block 810, J is 3 for the 8-bit Boothmultiplier building block 820, J is 5 for the 8-bit Booth multiplierbuilding block 830, and J is 7 for the 8-bit Booth multiplier buildingblock 840.

The carry input value provided to the each 8-bit Booth multiplierbuilding block 810-840 is zero, since there is no building block to theright, The IN value provided to the 8-bit Booth multiplier buildingblock 810 is zero, since there is no building block above, but the INvalue provided to each 8-bit Booth multiplier building block 820-840 istaken from the output of the previous 8-bit Booth multiplier buildingblock 810-830, respectively.

As can be seen in FIG. 8, the 8-bit IN value is composed of the GOUT bitfrom the previous block and the high seven bits of the OUT value fromthe previous block. Thus, the COUT value is treated as the MSB of a10-bit output. The 8-bit multiplier 800 generates a 16-bit product, P.Each of the 8-bit Booth multiplier building blocks 810-830 directlycomputes two bits of P. The 8-bit B multiplier building block 840computes the remaining ten bits of P.

Using the 8-bit Booth multiplier building blocks, larger multipliersthat multiply 8-bit A values by larger B values may be formed. For eachtwo bits increase in the size of B, an additional 8-bit Booth multiplierbuilding block is added and the size of P increases by two bits. Thus,five 8-bit Booth multiplier building blocks may be used to form an 8-bitby 10-bit multiplier that provides an 18-bit output, eight 8-bit Boothmultiplier building blocks may be used to form an 8-bit by 16-bitmultiplier that provides a 24-bit output, and so on.

FIG. 9 is a diagrammatic view of an 8-bit multiplier 900 using MSB Boothmultiplier building blocks 930A, 930B, 930C, and 930D, and 4-bit Boothmultiplier building blocks 910A, 910B, 910C, 910D, 920A, 920B, 920C, and920D. The 8-bit multiplier 900 multiplies an 8-bit A value by an 8-bit Bvalue to generate a 16-bit product (P) result. The 8-bit multiplier 900includes four rows of Booth multiplier building blocks, one row for eachtwo bits of multiplicand B. Each row includes two 4-bit Booth multiplierbuilding blocks, one for each four bits of multiplier A. Each row alsoincludes one MSB Booth multiplier building block. Thus, while FIG. 9shows an 8-bit multiplier, larger multipliers may be formed by addingone additional row for each two additional bits of the size of B andadding one additional 4-bit Booth multiplier building block to each rowfor each four additional bits of the size of A.

The first row of the 8-bit multiplier 900 comprises the 4-bit Boothmultiplier building blocks 910A and 920A and the MSB Booth multiplierbuilding block 930A. The building blocks 910A-930A take different partsof A as input, but all receive the first two bits of B (plus an appendedzero, noted as B[−1]). Since the first row has no preceding row, the INvalue is set to zero. The CIN value of the right-most 4-bit Boothmultiplier building block 910A is set to zero, and the COUT value ofeach 4-bit Booth multiplier building block 910A-920A is used as the CINvalue of the building block 920A-920B to the left.

The low two bits of the output from the right-most 4-bit Boothmultiplier building block 910A are used as the low two bits of P. Thehigh two bits of the output from the 4-bit Booth multiplier buildingblock 910A are combined with the low two bits of the output from the4-bit Booth multiplier building block 920A to provide the IN value tothe 4-bit Booth multiplier building block 910B in the next row. The hightwo bits of the output from the 4-bit Booth multiplier building block920A are combined with the output and COUT values from the MSBmultiplier building block 930A to provide the IN value to the 4-bitBooth multiplier building block 920B in the next row. The COUT valuefrom the MSB multiplier building block 930A is also provided as the INvalue to the MSB multiplier building block 930B in the next row.

The second row operates similarly to the first, except that the IN valueis as described above instead of being set to zero and the B input isB[3:1] instead of B[1: −1]. The two low bits of the output from the4-bit Booth multiplier building block 910B are used as the next two bitsof P, and the remainder of the output are fed into the third row as theIN values.

The third row operates similarly to the second, with the IN values takenfrom the output of the previous row and the B input now being B[5:3].The two low bits of the output from the 4-bit Booth multiplier buildingblock 910C are used as the next two bits of P, and the remainder of theoutput are fed into the fourth row as the IN values.

The fourth row operates similarly to the second and third, with the INvalues taken from the output of the previous row and the B input nowbeing B[7:5]. The four bits of the output from the right-most 4-bitBooth multiplier building block 910D are used as the next four bits ofP. The four bits of the output from the 4-bit Booth multiplier buildingblock 920D are used as the four bits of P after that. The COUT and OUTbits from the MSB multiplier building block 930D are used as the hightwo bits of P. In combination with the six bits of P provided by theprevious row, the final result is a sixteen bit product of A and B.

FIG. 10 is a diagrammatic view of a modified 6-bit LUT (LUT6) 1000,according to various embodiments of the invention. The LUT6 1000comprises LUT5 1010, LUT5 1020, multiplexer (MUX) 1030, and MUX 1040.The output of the LUT6 is provided on output 1050. Additional LUT5outputs 1060 and 1070 are provided. In addition to the standard sixinputs to a standard LUT6, the LUT6 1000 includes an input 1080. TheLUTE 1000 is configured during place and route of the FPGA including theLUT6 1000 as either a traditional LUT6 or as a pair of related LUT5s. Ifthe LUT6 1000 is configured as a traditional LUT6, the output of the MUX1030 to the LUT5 1010 is the standard fifth input, so the five inputs tothe LUT5 1010 and the LUT5 1020 are the same. If the LUT6 1000 isconfigured as a pair of related LUT5s, the output of the MUX 1030 to theLUT5 1010 is the input 1080, and the LUT5 1010 and the LUT5 1020 onlyhave four inputs in common.

When the LUT6 1000 operates as a standard LUT6, the output of the MUX1040 is the value of the input to the MUX. 1040 from the standard LUT6input. As a result, five of the six inputs are provided to both LUT5s1010, 1020. The output of each LUT5 1010, 1020 is provided as input tothe MUX 1040. The output of the MUX 1040 is selected based on the sixthinput to the LUT6 1000. The 1-bit output of the LUT6 1000 is provided onthe output 1050.

When the LUT6 1000 operates as two LUT5s, the input 1080 is provided asone of the five inputs to the LUT5 1010. Thus, the inputs to the LUT51010 may be different than the inputs to the LUT5 1020. The individualoutputs of the two LUT5s 1010 and 1020 are accessed via the output 1060,providing the output of the LUT5 1010, and the output 1070, providingthe output of the LUT5 1020. Thus, the LUT6 block 1.000 is designed suchthat it can he configured to behave as a traditional LUT6 or configuredas a pair of related LUT5s to support efficient multiplier buildingblocks.

FIG. 11 is a diagrammatic view of a modified block 1100 comprising twoLUT6 s, according to various embodiments of the invention. The modifiedblock 1100 comprises two modified. LUT6s 1105 and 1110. The modifiedLUTE 1105 comprises the LUT5s 1115 and 1120 and generates the outputs1135 and 1140, one from each of the LUT5s 1115 and 1120. The modifiedLUT6 1110 comprises the LUT5s 1125 and 1130 and generates the outputs1145 and 1150, one from each of the LUT5s 1125 and 1130. The modifiedblock 1100 also acts as a pass-through 1155 for a four-bit IN value,containing a result from a previous row for summing (or containing azero if the modified block 1100 is in the first row). Thus, the modifiedblock 1100 takes twelve inputs, the same as two traditional LUT6s (fivebits of A, three bits of B, and four bits of IN). The actual A and Binputs to the LUT6s 1105 and 1110 are shared instead of duplicated inthe inputs to the modified block 1100. As can be seen in FIG. 11, theLUT6 1105 takes A[I−2:I−4] and B[J:J−2] as inputs and the LUT6 1110takes A[1:1−2] and B[J:J−2] as inputs. Using a traditional blockincluding two LUT6s, the inputs A[I−2] and B[J:J−2] would be duplicated,using six inputs to the traditional two-LUT6 block. By contrast, themodified block 1100 takes each duplicated input only once and routes theincoming signals as shown. This frees up the additional four inputs andallows for pass-through of the IN value without using any additionalconnections.

The modified LUT6s 1105 and 1110 each take six inputs, like a standardLUT6, but the inputs are connected to the LUT5s differently than in theLUT6 1000. Instead of providing identical input to the two LUT5s andusing the sixth input to control a MUX to select the output, only threeidentical bits are provided to each LUT5. This modification allows eachmodified LUT6 to function as the LUT5s of two adjacent 1-bit Boothmultiplier building blocks 400, and allows the modified block 1100 tofunction as the LUT5s of an entire 4-bit Booth multiplier building block600. In some example embodiments, 2-bit Booth multiplier building blocksare used, with each 2-bit Booth multiplier building block using a singlemodified LUT6 1105 or 1110.

FIG. 12 is a diagrammatic view of a logic block 1200 using an instanceof the modified block 1100 to provide a 4-bit by 2-bit multiplier,according to various embodiments of the invention. The logic block 1200includes a modified two-LUT6 block 1210, an instance of the modifiedblock 1100, and a four-bit adder 1220. The LUT5 outputs 1135-1150 of themodified block 1100 are added to the four-bit IN value from the previousrow to generate a result of the multiplication.

The logic block 1200 allows dramatically improved packing compared withprior art logic blocks when implementing certain functions, such as themodified Booth algorithm with Baugh-Wooley multiplication. This improvedpacking results in a reduction in logic blocks required, byapproximately a factor of two, which further allows highermultiplier-accumulator (MAC) density, lower power consumption, or both.For example, operations per watt may be improved from about 0.5 to about2.1 trillion operations/watt.

The Abstract of the Disclosure is provided to comply with 37 C.F.R. §1.72(b), requiring an abstract that allows the reader to quicklyascertain the nature of the technical disclosure. It is submitted withthe understanding that it will not be used to interpret or limit theclaims. In addition, in the foregoing Detailed Description, it may beseen that various features are grouped together in a single embodimentfor the purpose of streamlining the disclosure. This method ofdisclosure is not to be interpreted as limiting the claims. Thus, thefollowing claims are hereby incorporated into the Detailed Description,with each claim standing on its own as a separate embodiment.

What is claimed is:
 1. A circuit comprising: a building block comprising: twelve block inputs; and two six-input lookup tables (LUTs), wherein four of the block inputs are provided to each of the two six-input LUTs and three of the four block inputs that are provided to each of the two six-input LUTs are Booth-encoded bits from a multiplicand.
 2. The circuit of claim 1, wherein four of the twelve block inputs are provided as outputs of the building block without being provided as inputs to either of the two six-input LUTs.
 3. The circuit of claim 1, wherein: the building block is a first building block; the first building block further comprises: an adder that receives a carry input and generates a carry output; the circuit further comprises one or more additional building blocks, each additional building block having the same structure as the first building block; and the carry input of each additional building block is coupled to the carry output of another additional building block or the carry output of the first building block.
 4. The circuit of claim 3, wherein the first building block and each additional building block of the one or more additional building blocks receives the three Booth-encoded bits from the multiplicand.
 5. The circuit of claim 3, wherein: the one or more additional building blocks are two additional building blocks comprising a second building block and a third building block; and the first building block, the second building block, and the third building block are configured to form an eight-bit Booth multiplier building block that generates an eight-bit product output and a one-bit carry output.
 6. The circuit of claim 5, wherein the third building block: comprises a five-input LUT that generates a one-bit output; and uses the one-bit output and a carry output from the second building block to generate the one-bit carry output and one bit of the eight-bit product output.
 7. The circuit of claim 5, wherein: the eight-bit Booth multiplier building block is a first eight-bit Booth multiplier building block; the circuit further comprises a second eight-hit Booth multiplier building block, a third eight-bit Booth multiplier building block, and a fourth eight-bit Booth multiplier building block; the second eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the first eight-bit Booth multiplier building block; and the one-bit carry output from the first eight-bit Booth multiplier building block; the third eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the second eight-bit Booth multiplier building block; and the one-bit carry output from the second eight-bit Booth multiplier building block; the fourth eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the third eight-bit Booth multiplier building block; and the one-bit carry output from the third eight-bit Booth multiplier building block; and the circuit generates a multiplication result of an eight-bit multiplier with an eight-bit multiplicand.
 8. A machine-readable storage medium containing instructions that when executed by a machine, cause the machine to program a field programmable gate array (FPGA) to generate a circuit comprising: a building block comprising: twelve block inputs; and two six-input lookup tables (LUTs), wherein four of the block inputs are provided to each of the two six-input LUTs and three of the four block inputs that are provided to each of the two six-input LUTs are Booth-encoded bits from a multiplicand.
 9. The machine-readable storage medium of claim 8, wherein four of the twelve block inputs are provided as outputs of the building block without being provided as inputs to either of the two six-input LUTs.
 10. The machine-readable storage medium of claim 8, wherein: the building block is a first building block; the first building block further comprises: an adder that receives a carry input and generates a carry output; the circuit further comprises one or more additional building blocks, each additional building block having the same structure as the first building block; and the carry input of each additional building block is coupled to the carry output of another additional building block or the carry output of the first building block.
 11. The machine-readable storage medium of claim 10, wherein the first building block and each additional building block of the one or more additional building blocks receives the three Booth-encoded bits from the multiplicand.
 12. The machine-readable storage medium of claim 10, wherein: the one or more additional building blocks are two additional building blocks comprising a second building block and a third building block; and the first building block, the second building block, and the third building block are configured to form an eight-bit Booth multiplier building block that generates an eight-bit product output and a one-bit carry output.
 13. The machine-readable medium of claim 12, wherein the third building block: comprises a five-input LUT that generates a one-bit output; and uses the one-bit output and a carry output from the second building block to generate the one-bit carry output and one bit of the eight-bit product output.
 14. The machine-readable storage medium of claim 12, wherein: the eight-bit Booth multiplier building block is a first eight-bit Booth multiplier building block; the circuit further comprises a second eight-bit Booth multiplier building block, a third eight-bit Booth multiplier building block, and a fourth eight-bit Booth multiplier building block; the second eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the first eight-bit Booth multiplier building block; and the one-bit carry output from the first eight-bit Booth multiplier building block; the third eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the second eight-bit Booth multiplier building block; and the one-bit carry output from the second eight-bit Booth multiplier building block; the fourth eight-bit Booth multiplier building block receives input comprising: six bits of the eight-bit sum output from the third eight-bit Booth multiplier building block; and the one-bit carry output from the third eight-bit Booth multiplier building block; and the circuit generates a multiplication result of an eight-bit multiplier with an eight-bit multiplicand.
 15. A system comprising: a memory that stores instructions; and one or more processors configured by the instructions to perform operations comprising: programming a field programmable gate array (FPGA) to generate a circuit comprising: a building block comprising: twelve block inputs; and two six-input lookup tables (LUTs), wherein four of the block inputs are provided to each of the two six-input LUTs and three of the four block inputs that are provided to each of the two six-input LUTs are Booth-encoded bits from a multiplicand.
 16. The system of claim 15, wherein four of the twelve block inputs are provided as outputs of the building block without being provided as inputs to either of the two six-input LUTs.
 17. The system of claim 15, wherein: the building block is a first building block; the first building block further comprises: an adder that receives a carry input and generates a carry output; the circuit further comprises one or more additional building blocks, each additional buildings block having the same structure as the first building block; and the carry input of each additional building block is coupled to the carry output of another additional building block or the carry output of the first building block.
 18. The system of claim 17, wherein the first building block and each additional building block of the one or more additional building blocks receives the three Booth-encoded bits from the multiplicand.
 19. The system of claim 17, wherein: the one or more additional building blocks are two additional building blocks comprising a second building block and a third building block; and the first building block, the second building block, and the third building block are configured to form an eight-bit Booth multiplier building block that generates an eight-bit product output and a one-bit carry output.
 20. The system of claim 19, wherein the third building block: comprises a five-input LUT that generates a one-bit output; and uses the one-bit output and a carry output from the second building block to generate the one-bit carry output and one bit of the eight-bit product output. 